package com.vhall.component.controller.interactive;


import com.alibaba.fastjson.JSON;
import com.vhall.component.controller.interactive.facade.DocumentCallbackFacade;
import com.vhall.component.entity.interactive.vo.DocumentUpdateReqVO;
import com.vhall.component.framework.common.annotation.VhallComponent;
import com.vhall.component.plugin.common.annotation.PaasCallbackSignAuth;
import com.vhall.component.service.interactive.DocumentsRoomService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;


/**
 * @author shenqing
 * @date 2021/6/9 17:32
 */
@Slf4j
@VhallComponent
public class DocumentCallbackController implements DocumentCallbackFacade {


    @Value("${paas.apps.lite.appId}")
    public String appId;

    @Autowired
    private DocumentsRoomService documentsRoomService;


    @Override
    @PaasCallbackSignAuth
    public String update(DocumentUpdateReqVO reqVO) {

        log.info("文档回调信息:{},{}", appId, JSON.toJSONString(reqVO));
        Boolean result = documentsRoomService.update(reqVO);
        if (result) {
            return "success";
        }
        return "fail";
    }
}
